import request from '@/utils/request'

// 获取配送单列表
export function pageDelivery(query) {
  return request({
    url: '/goods/delivery/paging',
    method: 'get',
    params: query
  })
}
// 统计配送单
export function statDelivery(query) {
  return request({
    url: '/goods/delivery/stat',
    method: 'get',
    params: query
  })
}

// 根据配送单id获取配送详情信息
export function getDelivery(deliveryId) {
  return request({
    url: '/goods/delivery/getDelivery',
    method: 'get',
    params: {
      deliveryId
    }
  })
}

// 生成配送单
export function doGenerateDelivery(params) {
  return request({
    url: '/goods/delivery/doGenerateDelivery',
    method: 'post',
    params
  })
}

// 确认配送
export function updateDeliveryStatus(params) {
  return request({
    url: '/goods/delivery/updateDeliveryStatus',
    method: 'post',
    params: params
  })
}

// 配送商品对应订单来源列表
export function getDeliveryDetailOrderSourceList(params) {
  return request({
    url: '/goods/delivery/getDeliveryDetailOrderSourceList',
    method: 'get',
    params: params
  })
}

// 根据配送单id获取配送日志
export function getDeliveryLogListByDeliveryId(deliveryId) {
  return request({
    url: '/goods/delivery/getDeliveryLogListByDeliveryId',
    method: 'get',
    params: {
      deliveryId
    }
  })
}

// 批量导出团长配送单
export function batchExportCommanderDelivery(params) {
  return request({
    url: '/goods/delivery/batchExportCommanderDelivery',
    method: 'post',
    params
  })
}
// 批量更新配送单状态为待签收（已发货）
export function batchDelivery(data) {
  return request({
    url: '/goods/delivery/batchDelivery',
    method: 'post',
    data: data
  })
}
